package com.baidu.controller;

import com.baidu.service.TbShopAuditService;
import com.baidu.utils.ResultResponse;
import com.baidu.vo.SellerManageVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 幻死
 * @version 1.0   商家管理
 * @description: TODO
 * @date 2021/8/23 9:07
 */
@RestController
@RequestMapping("sellerManage")
@CrossOrigin
public class SellerManageController {

    @Autowired      //商家管理
    TbShopAuditService shopAuditService;

    /**
     * @description pageListBy 分页 模糊
     * @params [vo]
     *      //页数 默认第一页 current = 1;
     *     //条数 默认三条一页 size = 5;
     *     //状态类型 state;
     *     //公司名称companyName;
     *     //店铺名称 shopName;
     * @return com.baidu.utils.ResultResponse
     * @author 幻死
     * @date 2021/8/23 10:49
     */
    @PostMapping(value = "pageListBy")
    public ResultResponse pageListBy(@RequestBody SellerManageVo vo){
        return shopAuditService.pageListBy(vo);
    }


    /**
     * @description getListById 根据ID得到对应的对象
     * @params [id]
     * @return com.baidu.utils.ResultResponse
     * @author 幻死
     * @date 2021/8/23 10:51
     */
    @PostMapping(value = "getListById/{id}")
    public ResultResponse getListById(@PathVariable("id") Integer id){
        return shopAuditService.getListById(id);
    }


    /**
     * @description changeStatus 根据前台传来的状态码，改变该对象的状态
     * @params [id, code] id 该商品id code 状态码
     * @return com.baidu.utils.ResultResponse
     * @author 幻死
     * @date 2021/8/23 10:58
     */
    @PostMapping(value = "changeStatus")
    public ResultResponse changeStatus(@RequestParam Integer id,@RequestParam Integer code){
        return shopAuditService.changeStatus(id,code);
    }



}
